<%@ page import="java.sql.*" %>
<%@include file="../connection.jsp" %>

<%
	try{
		HttpSession ses = request.getSession(true);
		String ses_username = ses.getValue("ses_uname").toString();
	
	if (ses_username.equals("admin"))
	{
	
%>
<link href="../css/style.css" rel="stylesheet" />

<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  </tr>
  <tr>
    <td align="center"><strong><font size="4" face="Arial, Helvetica, sans-serif"><br />
      Edit Data User <br />
      </font></strong><br />      
    </td>
  </tr>
  <tr>
    <td>
	<%
		String id = request.getParameter("id");
		String sql = "SELECT * FROM t_user WHERE id = '" + id + "'";
		rs = stmt.executeQuery(sql);

		if (rs.next())
		{   
			String username=rs.getString(2);
			String name=rs.getString(4);
			String email=rs.getString(5);
			String jeniskel=rs.getString(6);
	%>
	<form method="post" action="updateuser.jsp">
      <table width="" border="1" align="center" cellpadding="3" cellspacing="0">
        <tr>
          <td width="">Nama</td>
          <td width=""><input name="txtname" type="text" value="<% out.print(name); %>" />
            <input name="txtid" type="hidden" value="<% out.print(id); %>" /></td>
        </tr>
        <tr>
          <td>Username</td>
          <td><input name="txtusername" type="text" value="<% out.print(username); %>" /></td>
        </tr>
        <tr>
          <td>Email</td>
          <td><input name="txtemail" type="text" value="<% out.print(email); %>" /></td>
        </tr>
        <tr>
          <td>Jenis Kelamin</td>
          <td><input name="txtjeniskel" type="radio" <% if (jeniskel.equals("1")){ out.print("checked"); }%> value="1"/> Laki
				<input name="txtjeniskel" type="radio" <% if (jeniskel.equals("2")){ out.print("checked"); }%> value="2"/> Perempuan</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><div align="right"><input type="submit" name="Submit" value="Simpan" /></div></td>
        </tr>
      </table>
    </form>
	<%
		}
		}
		}
	catch(Exception e)
	{
		out.println("login Admin error");
	}
	%>
	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>